package com.example.demo.service;

import com.drew.imaging.ImageProcessingException;
import com.example.demo.entity.pojo.PictureInfo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Peng
 */
public interface UniversalService {

    /**
     * Read image info.
     *
     * @param file the file
     * @return the picture info
     * @throws ImageProcessingException the image processing exception
     * @throws Exception                the exception
     */
    PictureInfo readImageInfo(MultipartFile file) throws ImageProcessingException, Exception;

    /**
     * Gets ip str.
     * 根据请求获得请求的ip地址
     *
     * @param request the request
     * @return the ip str
     */
    String getIpStr(HttpServletRequest request);

    /**
     * Gets address by ip.
     * 根据ip过的ip归属地   (本方法使用的是GitHub中的开源项目ip2region)
     *
     * @param ip the ip
     * @return the address by ip
     */
    String getAddressByIp(String ip);
}
